home *** CD-ROM | disk | FTP | other *** search
/ s-gikan2.maizuru-ct.ac.jp / s-gikan2.maizuru-ct.ac.jp.zip / s-gikan2.maizuru-ct.ac.jp / pub / old / ncvc351d_install.exe / {app} / scripts / change_for_laser.pl < prev    next >
Perl Script  |  2012-10-11  |  2KB  |  63 lines

  1. #! /usr/bin/perl
  2.  
  3. #  NCVCé┼Åoù═é╡é╜NCâRü[âhé≡âîü[âUü[ë┴ìHï@ùpé╔ò╧è╖é╖éΘâXâNâèâvâg  #
  4. #   G01é┼ZÄ▓â}âCâiâXò√îⁿé╔É╪éΦì₧é▐âRü[âhé≡$ON_CodeüA             #
  5. #   G00é▄é╜é═G01é┼ZÄ▓âvâëâXò√îⁿé╔æ╥ö≡é╖éΘâRü[âhé≡$OFF_Code       #
  6. #  é╔ò╧è╖é╖éΘ                                                    #
  7. #  G90é╠âRü[âhé╠é▌æ╬ë₧                                           #
  8.  
  9. #  Ägéóò√é╠âRâc                                                  #
  10. #  (1)NCÉ╢ɼâIâvâVâçâôé╠É╪ìφî┤ô_(G92)é╠ZÆlé╞Rô_é≡                #
  11. #     É│(âvâëâX)é╠ô»é╢Ælé╔é╖éΘ(ù╝ò√â[âìé┼éαénéj)                 #
  12. #  (2)É╪éΦì₧é▌é≡â}âCâiâXÆlé╔é╖éΘ                                 #
  13. #  (3)òWÅÇâJâXâ^âÇâwâbâ_ü[é≡âîü[âUùpé╔âJâXâ^âÇ                   #
  14. #     {G90orG91}G54{G92_Initial} ü¿ {G90orG91}G92{G92X}{G92Y}    #
  15. #     {Spindle}M3                ü¿ ìφÅ£                         #
  16. #  é▒é╠É╪ìφÅ≡îÅé┼É╢ɼé╡é╜NCâRü[âhé≡üAé▒é╠âXâNâèâvâgé┼ò╧è╖é╖éΘé╞  #
  17. #  ZÆlé╠Åπë║é╔ìçéφé╣é─âîü[âUÅoù═é╠ON/OFFé¬ÉºîΣé┼é½é▄é╖           #
  18.  
  19.  
  20. #######################
  21.  
  22. #âîü[âUü[é≡âIâôé╔é╖éΘâRü[âh
  23. $ON_Code = 'M03';
  24.  
  25. #âîü[âUü[é≡âIâté╔é╖éΘâRü[âh
  26. $OFF_Code = 'M05';
  27.  
  28. #######################
  29.  
  30.  
  31. $pre_file= $ARGV[0];
  32. $out_file= $ARGV[1];
  33. open(IN,$pre_file);
  34. open(OUT,">$out_file");
  35.  
  36.  
  37. $G0X = -1;
  38. $Zn=1000;
  39. $Zp=1000;
  40.  
  41. while(<IN>){
  42.  
  43.     if(!/^N?[0-9\s]*[\(\%]/){
  44.  
  45.         if(/G0*?([0123])[A-Z\s]/){ $G0X= $1; }
  46.  
  47.         if($G0X != -1){
  48.             if(/Z([0-9\-\.]+)/){ $Zn = $1; }
  49.         }
  50.  
  51.         if($G0X == 1 && $Zn < $Zp){
  52.             $_ = $ON_Code . "\nG01";
  53.             $Zp = $Zn;
  54.         }
  55.         elsif(($G0X == 0 or $G0X == 1) && $Zn > $Zp){
  56.             $_ = $OFF_Code . "\nG0" . $G0X;
  57.             $Zp = $Zn;
  58.         }
  59.     }
  60.  
  61.     print OUT;
  62.  
  63. }